<!-- 子组件 List.vue -->
<template>
  <ul>
    <li v-for="item in list" :key="item.id">
      <!-- 向插槽传递 item 数据 -->
      <slot :item="item" :index="index"></slot>
    </li>
  </ul>
</template>

<script>
  export default {
    data() {
      return {
        list: [
          { id: 1, name: "苹果" },
          { id: 2, name: "香蕉" },
        ],
      };
    },
  };
</script>
